package com.gitee.srurl.snow.domain;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import java.io.Serial;
import java.io.Serializable;

/**
 * @author zxw
 * @date 2023/4/30 17:01
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class SnowflakeReportData implements Serializable {

    @Serial
    private static final long serialVersionUID = -134330936128574940L;

    private Long twepoch;

    private Long workerId;

    private Long dataCenterId;

    private Long sequence;

    private Long lastTimestamp;

    /**
     * 版本 三秒一次上报 暂时使用时间戳
     */
    private Long version;

    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.JSON_STYLE)
                .append("twepoch", getTwepoch())
                .append("workerId", getWorkerId())
                .append("dataCenterId", getDataCenterId())
                .append("sequence", getSequence())
                .append("lastTimestamp", getLastTimestamp())
                .append("version", getVersion())
                .toString();
    }
}
